from multiprocessing import Process, Queue

a = 100

def write_msg(q):
    global a
    if not q.full():
        for i in range(5):
            a -= 10
            q.put(a)
            print('a入队时的值:', a)

def read_msg(q):
    global a
    while not q.empty():
        print('a出队时的值:', q.get())

if __name__ == '__main__':
    q = Queue()

    p1 = Process(target=write_msg, args=(q,))
    p2 = Process(target=read_msg, args=(q,))
    p1.start()
    p2.start()
    p1.join()
    p2.join()
